public class test {
    //蓝桥杯 迷宫(⭐⭐⭐⭐)
    public class Main1 {
        static int n;
        static int m;
        static int arr[][];
        static int x[] = {-1, 0, 0, 1}; // x和y 在向 上下左右移动时 的变化
        static int y[] = {0, -1, 1, 0};
        static boolean f[][];
        static HashMap<Integer, ArrayList<int[]>> map;
        static LinkedList<int[]> queue;

        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            n = sc.nextInt();
            m = sc.nextInt();
            f = new boolean[n + 1][n + 1]; //存某个点是否被访问过
            map = new HashMap<Integer, ArrayList<int[]>>();  //存传送门数据
            queue = new LinkedList<int[]>();
            for (int i = 1; i <= m; i++) {
                int x1 = sc.nextInt();
                int y1 = sc.nextInt();
                int x2 = sc.nextInt();
                int y2 = sc.nextInt();
                add(map, x1, y1, x2, y2); //假如点a和点b是一对传送门，那从a能到b，也能从b到a
                add(map, x2, y2, x1, y1);

            }
            for (int i = 0; i < f.length; i++) {
                Arrays.fill(f[i], false);
            }

            queue.add(new int[]{n, n});
            f[n][n] = true;
            int count = 0; //存所有点距离终点最短距离的总和
            int ans = 0; //当前走的距离
            while (!queue.isEmpty()) {
                //每次循环当前队列中的元素，这次循环中的元素距离终点的距离就是都是ans
                int len = queue.size();
                while (len-- != 0) {
                    //取出一个元素，这个位置未被访问过记录步数到count
                    int t[] = queue.pollFirst();
                    if (f[t[0]][t[1]]) {
                        count += ans;
                    }
                    //尝试向四个方向搜索
                    for (int i = 0; i < 4; i++) {
                        int newX = t[0] + x[i];
                        int newY = t[1] + y[i];
                        //判断是否越界
                        if (newX < 1 || newX > n || newY < 1 || newY > n) {
                            continue;
                        }
                        //判断目标点是否被访问过 ，如果是把他入队 然后标记为不能走，防止被其他点重复走
                        if (!f[newX][newY]) {
                            queue.add(new int[]{newX, newY});
                            f[newX][newY] = true;
                        }
                    }

                    //如果有传送门，尝试走传送门
                    if (map.containsKey(t[0] * n + t[1])) {
                        for (int[] t1 : map.get(t[0] * n + t[1])) {
                            if (!f[t1[0]][t1[1]]) {
                                queue.add(new int[]{t1[0], t1[1]});
                                f[t1[0]][t1[1]] = true;
                            }
                        }
                    }

                }
                ans++;
            }
            System.out.printf("%.2f", (double) count / (n * n));

        }

        static void add(HashMap<Integer, ArrayList<int[]>> map, int x1, int y1, int x2, int y2) {
            if (!map.containsKey(x1 * n + y1)) map.put(x1 * n + y1, new ArrayList<int[]>());
            map.get(x1 * n + y1).add(new int[]{x2, y2});
        }
    }
    //蓝桥杯 质数(⭐⭐)
    public class Main {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            //在此输入您的代码...
            int n = in.nextInt();
            int num = 0;
            for(int i = 2;i < n;i++){
                if(decide3(i)){
                    System.out.print(i + " ");
                    num++;
                }
            }
            System.out.printf("\n%d",num);
            in.close();
        }
        public static boolean decide1(int n){
            for(int i = 2;i < n;i++){
                if(n % i == 0){
                    return false;
                }
            }
            return true;
        }
        public static boolean decide2(int n){
            for(int i = 2;(i*i) <= n;i++){
                if(n % i == 0){
                    return false;
                }
            }
            return true;
        }
        public static boolean decide3(int n){
            if(n <= 1) return false;
            if(n == 2 || n == 3) return true;
            if(n % 2 == 0 || n % 3 == 0) return false;
            for(int i = 5;(i*i) <= n;i+=6){
                if(n % i == 0 || n % (i + 2) == 0){
                    return false;
                }
            }
            return true;
        }
    }
}
